/*!*********************************************************************************
 * X2Engine Open Source Edition is a customer relationship management program developed by
 * X2 Engine, Inc. Copyright (C) 2011-2019 X2 Engine Inc.
 * 
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License version 3 as published by the
 * Free Software Foundation with the addition of the following permission added
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 * IN WHICH THE COPYRIGHT IS OWNED BY X2ENGINE, X2ENGINE DISCLAIMS THE WARRANTY
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU Affero General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 * 
 * You can contact X2Engine, Inc. P.O. Box 610121, Redwood City,
 * California 94061, USA. or at email address contact@x2engine.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * X2 Engine" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by X2 Engine".
 **********************************************************************************/




/*
Be careful when adding style rules outside of .x2-remote-page since it could introduce 
compatibility issues with PhoneGap app
*/

$errorRed: #C00;

@mixin header-button {
    color: $headerTextSecondary;
    font-size: 25px;
    padding: 0;
    display: inline-block;
    vertical-align: middle;
    top: 0;
}

@mixin page-with-panel {
    .x2-remote-page {
        .ui-page {
            overflow-y: hidden;
        }
        .panel-contents {
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            overflow-y: auto;
            width: 100%;
        }
    }
}


body {
    &.ui-panel-page-container {
        @include page-with-panel;
    }
    .ui-panel-page-container {
        @include page-with-panel;
    }
}

body.x2-phone-gap {
    ::-webkit-scrollbar {
        display: none;
    }

    ::-webkit-scrollbar-track {
        display: none;
    }

    ::-webkit-scrollbar-thumb {
        display: none;
    }
}

.x2-remote-page {

.flashes-container {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 40px;
    margin: auto;
    text-align: center;
    z-index: 1000;
    .flash-error, .flash-success, .flash-notice {
        display: none;
    }
    .flash-success, .flash-error {
        display: inline;
        padding: 7px 12px;
        &.flash-success {
            background: rgba(darken($gray, 23%), 0.90);
        }
        &.flash-error {
            background: rgba(red, 0.90);
        }
        color: white;
        border-radius: 20px;
        width: auto;
        @include animation(2s linear 1s fadeout);
        @include keyframes(fadeout) {
            from { 
                opacity: 1; 
            }
            to { 
                opacity: 0; 
            }
        }
        @include animation-fill-mode(forwards);
    }
}

.fixed-corner-button {
    z-index: 1000;
    background: $headerBackground;
    border: 1px solid $headerBackground;
    border-radius: 50%;
    display: block;
    width: 50px;
    height: 50px;
    line-height: 50px;
    position: fixed;
    color: $headerText;
    box-shadow: 0px 3px 4px lighten(black,65%);
    right: 25px;
    bottom: 25px;
    cursor: pointer;
    text-align: center;
}

a {
    color: $linkColor; 
}

.ui-content {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    padding: 0;
    z-index: 0;
    & + .nano-pane {
        top: $headerHeight !important;
    }
}

.innermost-content-container {
    top: $headerHeight !important;
}

&.tabbed-layout {
    .innermost-content-container {
        top: $headerHeight + $tabHeight !important; 
    }
}

.mobile-list-view {
    .list-view-section-title {
        @include list-item;
        color: $subduedTextColor;
        border-bottom: none;
        font-size: 18px;
        line-height: 41px;
    }
    .mobile-list-view-item {
        @include list-item;
        a {
            width: 100%;
        }
    }
}

div.x2touch-panel {
    .powered-by-container {
        text-align: center;
        padding: 15px 5px;
        a { 
            height: auto;
            line-height: normal;
        }
    }
    background: $panelBackgroundColor;
    color: $panelText;
    box-shadow: 2px -4px 4px darken($panelBackgroundColor,10%);
    &.no-scrollbar .panel-contents  {
        //overflow-y: hidden;
    }
    & > .ui-panel-inner {
        // extremely important rule, but unintuitively so. 
        // Prevents jqm from resizing the page to the
        // height of the panel. Allows panel to scroll independently in the y direction.
        // see the method "_positionPanel" in jqm 1.4.5
        height: 0; 
    }
    ul { 
        li {
            @include btn-states;
            &.selected::before {
                position: absolute;
                content: ' ';
                display: block;
                background: $greenHighlight;
                width: 5px;
                height: $panelItemHeight;
            }
            height: $panelItemHeight;
            border-bottom: 1px solid $panelBorder;
            a {
                width: 100%;
            }
            &.ui-li-divider {
                font-family: Arial;
                height: 25px;
                line-height: 13px;
                background: darken($panelBackgroundColor,7%);
                border-top: none;
                padding-left: 15px;
            }
        }
    }
    ul > li > a > i { 
        width: 50px;
        text-align: center;
        color: darken($panelBackgroundColor,18%);
        &::before {
            margin-top: 12px;
            font-size: 25px !important;
        }
    }
    ul > li > a > i, a { 
        display: inline-block;
        vertical-align: middle;
        height: $panelItemHeight;
        line-height: $panelItemHeight;
    }
    a {
        padding: 0;
        color: $panelText;
        border: none !important;
        text-decoration: none;
    }
}

.search-box {
    position: fixed;
    z-index: 1000;
    top: 0;
    width: 100%;
    background: $headerBackground;
    height: $headerHeight - 1px;
    box-shadow: 0px 1px 1px darken($headerBackground, 5%);
    div.ui-input-text {
        height: $headerHeight;
        padding-left: 10px;
        border: none;
        margin: 0;
        display: block;
        overflow: hidden;
        width: auto;
    }
    .search-cancel-button {
        @include header-button;
        display: block;
        float: left;
        margin: 0;
        margin-left: 10px;
        line-height: $headerHeight;
    }
    .search-clear-button {
        @include header-button;
        margin: 0;
        line-height: $headerHeight;
        position: absolute;
        right: 10px;
        top: 0;
    }
    input {
        height: $headerHeight;
        padding: 0;
        color: gray;
        font-size: $headerTextSize;
    } 
    input::-webkit-input-placeholder {
        color: gray;
        font-size: $headerTextSize;
    }
}

#header {
    z-index: 1000;
    position: fixed;
    width: 100%;
    background: $headerBackground;
    border-bottom: none;
    border-top: none;
    height: $headerHeight;
    box-shadow: 0px 1px 1px darken($headerBackground, 5%);
    line-height: $headerHeight;
    .header-back-button {
        @include header-text-button;
        display: inline-block;
        position: absolute;
    }
    h1.page-title {
        padding: 0;
        display: inline-block;
        vertical-align: middle;
        margin: auto;
        width: 100%;
        color: $headerText;
        font-size: $headerTextSize;
    }
    & > a {
    }
    .show-left-menu-button {
        font-size: 25px;
        padding: 0;
        display: block;
        color: $headerTextSecondary;
    }
    .ui-btn {
        @include header-button;
    }
    .search-button, .icon-btn {
        float: right;
        position: absolute;
        top: 0;
        right: 10px;
        margin: 0;
    }
    .show-settings-menu {
        padding: 0 9px;
    }
    .header-content-right {
        position: absolute;
        right: 0;
        top: 0;
    }
}

#footer {
    &.control-panel {
        border-bottom: none;
        width: 100%;
        background: $backgroundColor;
        height: auto;
        line-height: 50px;
        border-top: 1px solid $lightGray;
        padding: 5px 10px;
        line-height: 40px;
    }
    &.fixed-footer {
        position: fixed;
        bottom: 0;
    }
    .icon-button {
        display: inline-block;
        height: 40px;
        font-size: 30px;
        line-height: 40px;
        vertical-align: middle;
        cursor: pointer;
        width: 40px;
        text-align: center;
        color: $subduedTextColor;
    }
}

#settings-menu-popup {
    top: 41px !important;
    //right: 10px !important;
    margin-right: 10px;
    background: $menuBackgroundColor;
    color: $menuText;
    .ui-popup {
        border: none;
    }
    a {
        color: $menuText;
        border: none;
        text-decoration: none;
    }
    box-shadow: 0px 3px 11px #2D2D2D;
}

$errorBackgroundColor:lighten(red,19%);

.errorSummary {
    background: $errorBackgroundColor;
    border: 1px solid darken($errorBackgroundColor, 5%);
    border-radius: 3px;
    padding: 10px;
}

&.mobile-login { 
    //background: radial-gradient($defaultBgColor, darken($defaultBgColor, 10%));
    background: $defaultBgColor;
    /* @theme background: background */
}

// override to prevent icon from being inserted since "data-icon", used by X2Engine to insert
// font icons, is also used by jQuery mobile
[data-icon]:before { content: none!important; }


/* 
general css rules
*/

.x2-mobile-narrow-input {
  color: #ADADAD;
  width: 280px;
}

.x2-mobile-narrow-input-row .ui-input-text {
  margin-bottom: 4px;
  margin-top: 0px;
  width: 280px;
  display: inline-block;
}

div {
  &.ui-input-text.error {
    //border-color: #C00;
    //background: #FEE;
  }
  &.input-error-container {
    float: left;
    margin-right: 4px;
  }
  &.err-msg-placeholder {
    height: 20px;
  }
}

/*
activity
*/

#feed-box {
  div.message {
    margin-bottom: 10px;
    white-space: pre-wrap;
  }
  a {
    /* links disabled until mobile versions of linked pages are added */
    color: #4b4b4b;
    text-decoration: none;
  }
  span.my-username {
    color: #999;
  }
}

#feed-post-publisher {
  margin-bottom: 10px;
}

#attachments {
  margin: 18px -2px;
  border: 1px solid #b8b8b8;
  padding: 6px;
  border-radius: 8px;
}

#logo-container {
  text-align: center;
}

#footer {
    a.full-site-link {
        //margin-left: 3px;
    }
}

/***********************************************************************
* scroll bar 
***********************************************************************/

//.nano > .nano-pane   { background: #888; }
//.nano > .nano-pane > .nano-slider { background: #111; }
.nano { 
    .nano-pane { 
        background: none !important;  
        width: 7px !important;
        .nano-slider {
            border-radius: 0 !important;
        }
    }
}

//.ui-panel-wrapper {
//    ::-webkit-scrollbar {
//        height: 10px;
//        &:vertical {
//            width: 5px;
//        }
//    }
//
//    ::-webkit-scrollbar-track {
//        &:horizontal {
//            border-top: 1px solid rgb(230, 230, 230);
//        }
//        border-left: 1px solid rgb(230, 230, 230);
//    }
//
//    ::-webkit-scrollbar-thumb {
//        background-color: rgb(216, 216, 216);
//    }
//}

//.x2touch-panel {
//    ::-webkit-scrollbar {
//        height: 10px;
//        &:vertical {
//            width: 5px;
//        }
//    }
//
//    ::-webkit-scrollbar-track {
//        &:horizontal {
//            border-top: 1px solid rgb(230, 230, 230);
//        }
//        border-left: 1px solid $panelBorder;
//    }
//
//    ::-webkit-scrollbar-thumb {
//        background-color: $panelBorder;
//    }
//}

}

